home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************/
- /* WhichWindow */
- /* This routine matches a WindowPtr with an entry in the window table windTbl, */
- /* returning the subscript of the entry. Return code is one if a match is not */
- /* found and zero if a match is found. */
- /* If a NIL window pointer is passed into this routine, the result is the same */
- /* as if the front window had been found to match. This is in case the front */
- /* window has been hidden and there are no other windows active. The FrontWindow */
- /* function would have returned NIL, which would have been passed here. We would */
- /* still want to use the front window's record, even though the window is hidden. */
- /************************************************************************************/
-
- #include "MyHeaders.h"
-
- short WhichWindow(WindowPtr WhichWindPtr, short * WhichSubscript)
- {
- short WhichWindRetCode = 1; /* default return code is bad */
-
- if (WhichWindPtr == NIL)
- { /* if FrontWindow returned NIL */
- *WhichSubscript = 0; /* point to main window rec */
- WhichWindRetCode = 0; /* set return code to good */
- goto ENDING; /* get out */
- }
-
- for (j=0; j<windMax; j++) /* check the table for.. */
- if (WhichWindPtr == windTbl[j].windPtr) /* ..a match with pointer */
- { /* if there is a hit.. */
- *WhichSubscript = j;
- WhichWindRetCode = 0; /* set return code to good */
- break; /* get out of the loop */
- }
-
- ENDING:
- return WhichWindRetCode;
- }